package com.example.apple.hxbtc.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.example.apple.hxbtc.R;
import com.example.apple.hxbtc.view.View_Dialog;

/**
 * Created by hpz on 17/2/21.
 */

public class AboutActivity extends BaseActivity {

    private RelativeLayout relativeLayout_setting;
    private RelativeLayout relativeLayout_check;
    private RelativeLayout relativeLayout_phone;
    private RelativeLayout relativeLayout_refresh;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.activity_about);
        setTitle("关于公司");
        relativeLayout_setting = (RelativeLayout) findViewById(R.id.aboutus_hotline);
        relativeLayout_setting.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent_setting = new Intent();
                intent_setting.setClass(AboutActivity.this,SettingActivity.class);
                startActivity(intent_setting);
            }
        });
        relativeLayout_phone = (RelativeLayout) findViewById(R.id.aboutus_phone);
        /*relativeLayout_phone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                *//*new AlertDialog.Builder(AboutActivity.this)
                        .setTitle("客服热线")
                        .setMessage("0755—66666666")
                        .setPositiveButton("拨打",
                                new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog,
                                                        int which) {
                                        Toast.makeText(getApplicationContext(),
                                                "拨打中..", Toast.LENGTH_SHORT)
                                                .show();
                                    }
                                })
                        .setNegativeButton("取消",
                                new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog,
                                                        int which) {
                                    }
                                }).setCancelable(false).show();*//*
                showDialog();

            }
        });*/
        relativeLayout_phone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showDialog("咨询请拨打", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();

                    }
                });
            }
        });

        relativeLayout_check = (RelativeLayout) findViewById(R.id.aboutus_check_version);
        relativeLayout_check.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(AboutActivity.this,"当前已经是最新版本", Toast.LENGTH_SHORT).show();
            }
        });
        relativeLayout_refresh = (RelativeLayout) findViewById(R.id.aboutus_refresh);
        relativeLayout_refresh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Intent intent_refresh = new Intent();
                //intent_refresh.setClass(AboutActivity.this,RefreshActivity.class);
                //startActivity(intent_refresh);
            }
        });
            }

    private View_Dialog dialog;

    public void showDialog(String content, View.OnClickListener listener) {
        dialog = new View_Dialog(AboutActivity.this, content);
        dialog.setContentText(content);
        dialog.setLeftBtnListener(getString(R.string.no),
                new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();
                    }
                });
        dialog.setRightBtnListener(getString(R.string.yes),
                listener);
        if (dialog != null)
            dialog.show();

    }

}


